define(['jquery', 'bootstrap', 'utilback', 'table', 'form', 'myfileinput'], function($, undefined, Utilback, Table, Form, myfileInput) {

	var Controller = {
		config: {
			get_url: '/user/read/detail', // 获取用户详情
		},
		init: function() {
                Table.api.init({
                    singleSelect:true,
                    extend:{
                        index_url: './json/runReveal.json', // 查询列表
                        del_url: '/user', // 删除
                        add_url:'overhaulProjectAdd.html',
                        edit_url:'overhaulProjectAdd.html',
                        multi_url: '/user',
                        info_url:'',//信息的页面
                    }
                });
                    var paramTable = $("#repairTable");
                    // 初始化表格
                    paramTable.bootstrapTable({
                        url:$.fn.bootstrapTable.defaults.extend.index_url,
                        method:'get',
                        columns:[
                            [
                                {field:'state',checkbox:true},
                                {field:'id',title:'ID'},
                                {field:'data',title:'车辆类型'},
                                {field:'orderNum',title:'定期保养周期-公里数'},
                                {field:'orderContent',title:'定期保养周期-时间'},
                                {field:'startingStation',title:'探伤周期-公里数'},
                                {field:'time',title:'探伤周期-时间'},
                                {field:'minDistance',title:'小修周期-公里数'},
                                {field:'minTime',title:'小修周期-时间'},
                                {field:'maxDistance',title:'大修周期-公里数'},
                                {field:'maxTime',title:'大修周期-时间'},
                                {field:'repairCycle',title:'检验周期'},
                                {field: 'operate', title: __('Operate'), events: Table.api.events.operate, formatter: function (value, row, index) {
								return Table.api.formatter.operate.call(this, value, row, index, paramTable)}}
                            ]
                        ]
                    });
                    // 为表格绑定事件
                    Table.api.bindevent(paramTable);
        },

		edit: function() { // 初始化编辑页面
			// 导入的时间绑定
			myfileInput.init.initSubmit('excelFile');
			Form.api.bindevent($("form[role=form]"));
			Form.api.fill($("form[role=form]"), './json/overhaulMaintenanceProject.json', 1);
		},
		update: function() {
			Form.api.bindevent($("form[role=form]"));
			Util.api.ajax({
				type: 'GET',
				url: '/user/read/current'
			}, function(data) {
				$('#edit-form').autofill(data);
			});
		}
	};
	return Controller;

	function changeAgentContent() {
		document.getElementById("inputFileAgent").value = document.getElementById("inputFile").value;
	}
});